<html>
<head>
<title>OGR ElasticSearch Driver</title>
</head>

<body bgcolor="#ffffff">

<h1>ElasticSearch:  Geographically Encoded Objects for ElasticSearch</h1>

(Driver available in GDAL 1.10 or later)</br>

Driver is <b>WRITE Only</b>
<p>

<a href="http://elasticsearch.org/">ElasticSearch</a> is an Enterprise-level search engine for a variety of data sources. It supports full-text indexing and geospatial querying of those data in a fast and effecient manor using a predefined REST API. This driver serializes all of the supported OGR file formats in to an ElasticSearch index.
<h2>Field definitions</h2>

Fields are dyamically mapped from the input OGR data source. However, the driver will take advatage of advanced options within ElasticSearch as defined in a <a href="http://code.google.com/p/ogr2elasticsearch/wiki/ModifyingtheIndex">field mapping file</a>.

<p>
The mapping file allows you to modify the mapping according to the <a href="http://www.elasticsearch.org/guide/reference/mapping/core-types.html">ElasticSearch field-specific types</a>. There are many options to choose from, however, most of the functionality is based on all the different things you are able to do with text fields within ElasticSearch.
<pre>
ogr2ogr -progress --config ES_WRITEMAP /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
</pre>
<p> 

The ElasticSearch writer supports the following Configuration Options:
<ul>
<li> <b>ES_WRITEMAP</b>=/path/to/mapfile.txt Creates a mapping file that can be modified by the user prior to insert in to the index.<br>
<li> <b>ES_META</b>=/path/to/mapfile.txt Tells the driver to the user-defined field mappings.<br>
<li> <b>ES_BULK</b>=10000 Identifies the number of records to be inserted at a time. Lower record counts help with memory consumption within ElasticSearch but take longer to insert.<br>
<li> <b>ES_OVERWRITE</b>=1 Overwrites the current index by deleting an existing one.<br>

</ul>
<p>

<p>
It is possible to apply several options at a time. The following use case takes advantage of a predefined mapping file as well as a limited <b>BULK</b> insert count.
<pre>
ogr2ogr -progress --config ES_OVERWRITE 1 --config ES_BULK 10000 --config ES_META /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
</pre>
</li>

<h2>Examples</h2>

<b>Basic Transform:</b> </br>
<pre>
ogr2ogr -progress -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
</pre>

<b>Create a Mapping File:</b> </br>
The mapping file allows you to modify the mapping according to the <a href="http://www.elasticsearch.org/guide/reference/mapping/core-types.html">ElasticSearch field-specific types</a>. There are many options to choose from, however, most of the functionality is based on all the different things you are able to do with text fields. 
</br>
<pre>
ogr2ogr -progress --config ES_WRITEMAP /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
</pre>

<b>Read the Mapping File:</b> </br>
Reads the mapping file during the transformation</br>
<pre>
ogr2ogr -progress --config ES_META /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
</pre>

<b>Bulk Uploading (for larger datasets):</b> </br>
Bulk loading helps when uploading a lot of data. The integer value is the number of bytes that are collection before being inserted. 
</br>
<pre>
ogr2ogr -progress --config ES_BULK 10000 -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
</pre>

<b>Overwrite the current Index:</b> </br>
If specified, this will overwrite the current index. Otherwise, the data will be appended. 
</br>
<pre>
ogr2ogr -progress --config ES_OVERWRITE 1 -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
</pre>

<b>Specify several at a time:</b> </br>
Several flags can be set at the same time. </br>
<pre>
ogr2ogr -progress --config ES_OVERWRITE 1 --config ES_BULK 10000 --config ES_META /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
</pre>
<p>

<h2>See Also</h2>

<ul>
<li> <a href="http://elasticsearch.org/">Home page for ElasticSearch</a>
<li> <a href="http://code.google.com/p/ogr2elasticsearch/w/list">Examples Wiki</a>
<li> <a href="http://groups.google.com/group/ogr2elasticsearch">Google Group</a>

<p>
</ul>

</body>
</html>
